import {createRouter,createWebHistory} from 'vue-router'

//导入组件
  import LoginVue from '@/views/Login.vue'
  import LayoutVue from '@/views/Layout.vue'
  import ArticleCategoryVue from '@/views/article/Student.vue'
  import ArticleManageVue from '@/views/article/Academic.vue'
  import TotalScoreVue from '@/views/article/TotalScore.vue'
  import RulesVue from '@/views/article/Rules.vue'
  import Studentin2Vue from '@/views/article/Studentin2.vue'
  import Studentin3Vue from '@/views/article/Studentin3.vue'
  import UserAvatarVue from '@/views/user/UserAvatar.vue'
  import UserInfoVue from '@/views/user/UserInfo.vue'
  import UserResetPasswordVue from '@/views/user/UserResetPassword.vue'
  //定义路由关系 数组里面有多个对象
  const routes=[
    {path:'/login',component:LoginVue},//path表示访问路径 访问路径之后显示对应的loginvue组件
    //默认访问article/manage
    {path:'/',component:LayoutVue,redict:'/yanjiusheng/student',
    //子路由
    children:[
        {path:'/yanjiusheng/student',component:ArticleCategoryVue},
        {path:'/yanjiusheng/academic',component:ArticleManageVue},
        {path:'/yanjiusheng/total_score',component:TotalScoreVue},
        {path:'/yanjiusheng/rules',component:RulesVue},
        {path:'/yanjiusheng/studentin2',component:Studentin2Vue},
        {path:'/yanjiusheng/studentin3',component:Studentin3Vue},
        {path:'/user/info',component:UserInfoVue},
        {path:'/user/avator',component:UserAvatarVue},
        {path:'/user/resetPassword',component:UserResetPasswordVue}
    ]
    },
  ]

  //创建路由器
  const router = createRouter({
    history:createWebHistory(),//这个模块本质是一个函数
    routes:routes
  })

  //导出路由
  export default router